package com.smartClassroom.media.service;

import com.smartClassroom.base.model.PageParams;
import com.smartClassroom.base.model.PageResult;
import com.smartClassroom.base.model.RestResponse;
import com.smartClassroom.media.model.dto.QueryMediaParamsDto;
import com.smartClassroom.media.model.dto.UploadFileParamsDto;
import com.smartClassroom.media.model.dto.UploadFileResultDto;
import com.smartClassroom.media.model.po.MediaFiles;
import org.springframework.transaction.annotation.Transactional;

import java.io.File;

public interface MediaFilesService {
    UploadFileResultDto uploadFile(Long companyId, UploadFileParamsDto uploadFileParamsDto, String localFilePath,String objectName);

    @Transactional
    MediaFiles addMediaFilesToDb(Long companyId, String fileMd5, UploadFileParamsDto uploadFileParamsDto, String bucketMediafiles, String objectName);

    PageResult<MediaFiles> queryMediaFiels(Long companyId, PageParams pageParams, QueryMediaParamsDto queryMediaParamsDto);

    RestResponse<Boolean> checkFile(String fileMd5);

    RestResponse<Boolean> checkChunk(String fileMd5, int chunk);

    RestResponse uploadChunk(String fileMd5, int chunk, String localFilePath);

    RestResponse mergechunks(Long companyId, String fileMd5, int chunkTotal, UploadFileParamsDto uploadFileParamsDto);

    public File downloadFileFromMinIO(String bucket, String objectName);

    public boolean addMediaFilesToMinIO(String localFilePath,String mimeType,String bucket, String objectName);

    MediaFiles getFileById(String mediaId);
}
